<template>
  <div style="width:200px;height:100vh">
    <el-menu
      :default-active="activeIndex"
      style="text-align: left;width:200px;height:90vh"
      @select="handleSelect">
      <el-menu-item index="/main">
        <i class="el-icon-menu"></i>
        <span slot="title">活动列表</span>
      </el-menu-item>
      <el-menu-item index="/insert">
        <i class="el-icon-edit-outline"></i>
        <span slot="title">活动发布</span>
      </el-menu-item>
      <el-menu-item index="/examine">
        <i class="el-icon-finished"></i>
        <span slot="title">活动审核</span>
      </el-menu-item> 
      <el-menu-item index="/user-manager">
        <i class="el-icon-user"></i>
        <span slot="title">用户管理</span>
      </el-menu-item>
      <el-menu-item index="/authentication">
        <i class="el-icon-data-line"></i>
        <span slot="title">活动认证</span>
      </el-menu-item>
    </el-menu>
    <div>
      <el-button @click="logout">退出登录</el-button>
    </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            activeIndex:'/main'
        }
    },
    methods:{
        handleSelect(val){
            console.log('获取的id',val);
            this.activeIndex = val
            console.log('----',this.$route.fullPath);
            if(this.$route.fullPath!==val){
              this.$router.push(val)
            }
        },
        logout(){
          this.$confirm('确定要退出登录吗？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            localStorage.removeItem('user')
            localStorage.removeItem('token')
            this.$router.push('/alogin')
          }).catch(() => {
                   
          });
        }
    }
}
</script>

<style>

</style>